
#include <memory.h>

#define DUA_CORE

#include "dua_def.h"


static void
freeStack(DuaObj* obj) {

}


extern void*
duaNewObj(DuaState* D, int type, size_t sz){
    DuaObj* obj = duaMalloc(D, sz);
    return obj;
}


extern DuaState*
duaNewStack(DuaState* D) {
    DuaState* nD = duaNewObj(D, DUA_TSTACK, sizeof(DuaState));
    nD->top = 0;
    nD->vm = D->vm;
    nD->parent = D;
    nD->slot = duaMalloc(D, sizeof(DuaValue) * nD->cap);
    nD->cap = 16;
    nD->obj.free = freeStack;
    return nD;
}